package com.jiukuaidao.zhulin.module.shoppingcart;

import android.text.TextUtils;

import com.jiukuaidao.zhulin.data.TasksRepository;
import com.jiukuaidao.zhulin.module.BasePresenter;

/**
 * Author : BinarySatan
 * Date : 2016/6/7
 * Description :
 */
public class ShoppingPresenter extends BasePresenter<ShoppingCartContract.View, TasksRepository> implements ShoppingCartContract.Presenter {
    public ShoppingPresenter(TasksRepository repository, ShoppingCartContract.View view) {
        super(repository, view);
    }

    @Override
    public void start() {

    }

    @Override
    public boolean isEmpty() {
        return mView.getShoppingCartDatas().items.size() <= 0;
    }

    @Override
    public boolean isAreOverStartPrice() {
        String startPrice = mView.getStartPrice();
        String totalPrice = mView.getTotalPrice();
        if (TextUtils.isEmpty(startPrice) || TextUtils.isEmpty(totalPrice))
            return false;

        return Double.parseDouble(startPrice) < Double.parseDouble(totalPrice);
    }


}
